package com.next.aappublicapp.adapters;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.next.aap.client.CandidateDto;
import com.next.aappublicapp.R;

public class CandidateListAdapter extends ArrayAdapter<CandidateDto> {
 
	public CandidateListAdapter(Context context, List<CandidateDto> values) {
		super(context, R.layout.activity_candidate_list, values.toArray(new CandidateDto[values.size()]));
	}
 
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 
		View rowView = inflater.inflate(R.layout.candidate_row, parent, false);
		TextView textView = (TextView) rowView.findViewById(R.id.candidate_name);
		textView.setText(getItem(position).getName());
		/*
		if(position % 2 == 0){
			acRow.setBackgroundColor(Color.WHITE);
		}else{
			acRow.setBackgroundColor(Color.LTGRAY);
		}
		*/
		return rowView;
	}
}
